using System.Xml.Serialization;

namespace ibba.src.noriskbo //.code.helpers
{
    public static class WRApplicationServiceHelper
    {
        public static void SalvarLogAuditoria(LogAuditoria pLog)
        {
            string log = (new IBBA.WebRiskV4.Xml.Serialization.XmlSerializer<LogAuditoria>()).Serialize(pLog);

            ServiceFactory.Instance.WRApplicationService.BeginSaveAuditLog(AppHelper.NomeSistema,
                        new WRApplicationService.WRUserCredentials()
                        {
                            WebServer = AppHelper.Servidor,
                            UserName = AppHelper.LoginUsuario,
                            UserFullName = AppHelper.NomeUsuario,
                            UserHostName = AppHelper.MaquinaUsuario
                        }, 
                        log, null, null);
        }
    }

    [XmlRoot("LogAuditoria")]
    public class LogAuditoria
    {
        [XmlAttribute("Acao")]
        public string Acao { get; set; }

        [XmlAttribute("Mensagem")]
        public string Mensagem { get; set; }
    }
}
